{% extends 'layouts/base.html' %}
{% block content %}
<div class="row">
    <div class="col-xs-12">
        <!-- PAGE CONTENT BEGINS -->
        <form action="{{ url('backend/models/edit', {m_id:models.m_id}) }}" class="form-horizontal" role="form" method="post" enctype="multipart/form-data">

            <div class="form-group{% if errors['m_name'] is not empty %} has-error{%endif%}">
                <label for="m_name" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">车型名称<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="m_name" placeholder="车型名称" name="m_name" class="col-xs-12" value="{{models.m_name}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['m_name'] is not empty %}{{errors['m_name']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['m_free'] is not empty %} has-error{%endif%}">
                <label for="m_free" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">费用<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="m_free" placeholder="费用" name="m_free" class="col-xs-12" value="{{models.m_free}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['m_free'] is not empty %}{{errors['m_free']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['m_driver'] is not empty %} has-error{%endif%}">
                <label for="m_driver" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">司机<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="m_driver" placeholder="司机" name="m_driver" class="col-xs-12" value="{{models.m_driver}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['m_driver'] is not empty %}{{errors['m_driver']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['company'] is not empty %} has-error{%endif%}">
                <label for="company" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">单位<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="company" placeholder="单位" name="company" class="col-xs-12" value="{{models.company}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['company'] is not empty %}{{errors['company']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['state'] is not empty %} has-error{%endif%}">
                <label for="state" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">状态<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="state" placeholder="状态" name="state" class="col-xs-12" value="{{models.state}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['state'] is not empty %}{{errors['state']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['addtime'] is not empty %} has-error{%endif%}">
                <label for="addtime" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">添加时间<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="addtime" placeholder="添加时间" name="addtime" class="col-xs-12" value="{{models.addtime}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['addtime'] is not empty %}{{errors['addtime']}}{% else %} {%endif%} </div>
            </div>



            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-info" type="submit">
                        <i class="ace-icon fa fa-check bigger-110"></i>
                        鎻愪氦
                    </button>

                    &nbsp; &nbsp; &nbsp;
                    <a class="btn" href="javascript:;" onclick="history.back(); ">
                        <i class="ace-icon fa fa-undo bigger-110"></i>
                        杩斿洖
                    </a>
                </div>
            </div>

        </form>
    </div><!-- /.col -->
</div><!-- /.row -->
{% endblock %}
{% block script %}

<script type="text/javascript">
    $(document).ready(function(){

        $(".ace-switch").each(function () {
            var aceswitch = this;

            aceswitch.addEventListener("click", function(){
                id = this.id.replace("_radio", "");
                if(this.checked){
                    $("#"+id).val('1');
                } else {
                    $("#"+id).val('0');
                }
                });
        });
    });
</script>
{% endblock %}
